cmake_minimum_required(VERSION 2.8)

add_definitions(-DSTM32F103xE)
#add_definitions(-DSTM32F107xC)
project(system C)

if (NOT CMAKE_BUILD_TYPE)
  #set(CMAKE_BUILD_TYPE Debug)
  set(CMAKE_BUILD_TYPE Release)
  #set(CMAKE_BUILD_TYPE RelWithDebInfo)
endif ()

set(KERNEL_INC
    kernel/
    kernel/ucos3/
    kernel/ucos3/uCOS-III/Source/    
    kernel/ucos3/uCOS-III/Ports/ARM-Cortex-M3/Generic/GNU/
    kernel/ucos3/config/
    kernel/ucos3/uC-CPU/ARM-Cortex-M3/GNU/
    kernel/ucos3/uC-CPU/
    kernel/ucos3/uC-LIB/
    kernel/ucos3/uC-LIB/Ports/ARM-Cortex-M3/Generic/GNU/
)

set(KERNEL_SRC   
    kernel/*.c
    kernel/ucos3/*.c
    kernel/ucos3/uCOS-III/Source/*.c
    kernel/ucos3/uCOS-III/Ports/ARM-Cortex-M3/Generic/GNU/*.c
    kernel/ucos3/uCOS-III/Ports/ARM-Cortex-M3/Generic/GNU/*.s
    kernel/ucos3/uC-LIB/Ports/ARM-Cortex-M3/Generic/GNU/*.c
    kernel/ucos3/uC-LIB/*.c
    kernel/ucos3/uC-CPU/ARM-Cortex-M3/GNU/*.c
    kernel/ucos3/uC-CPU/ARM-Cortex-M3/GNU/*.s
    kernel/ucos3/uC-CPU/*.c
    kernel/ucos3/config/*.c
)

set(PROCJECT_INCLUDE 
    platform/
    platform/devices #temp
    system/
    system/lib
    platform/include/
    platform/lib/
    board/CMSIS/Device/ST/STM32F1xx/Include/
    board/CMSIS/Include/
    board/STM32F1xx_HAL_Driver/Inc
    Core/Inc
    apps/utils
    apps/gui
    apps/task
    ./
    ${KERNEL_INC}
    )

file(GLOB PROCJECT_FILES
    platform/include/*.c
    platform/*.c
    platform/lib/*.c
    system/*.c
    system/lib/*.c
    platform/devices/*.c
    platform/drivers/*.c
    board/STM32F1xx_HAL_Driver/Src/*.c
    Core/Src/*.c
    Core/Startup/*.s
    apps/utils/*.c
    apps/gui/*.c
    apps/task/*.c
    ${KERNEL_SRC}
)

add_executable(system_app test.c ${PROCJECT_FILES})
target_include_directories(system_app PUBLIC ${PROCJECT_INCLUDE})
target_link_libraries(system_app ${PROCJECT_LIBRARIES} )







